package com.xizimall.controller;

import java.util.List;

import org.apache.http.impl.cookie.PublicSuffixFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * 内容分类管理
 * <p>Title: ContentCategoryController</p>
 * <p>Description: </p>
 * <p>华南理工大学研究生</p> 
 * @author	李隆熹
 * @date	2018年4月18日下午2:41:02
 * @version 1.0
 */
import org.springframework.web.bind.annotation.ResponseBody;

import com.xizimall.service.ContentCategoryService;
import com.xizimall.common.pojo.EUTreeNode;
import com.xizimall.common.pojo.XizimallResult;
@Controller
@RequestMapping("/content/category")
public class ContentCategoryController {
    @Autowired
   private  ContentCategoryService categoryService;
    
    @RequestMapping("/list")
    @ResponseBody
    public List<EUTreeNode> getContentCategoryList(@RequestParam(value="id",defaultValue="0")Long parentId){
    	List<EUTreeNode>list =categoryService.getContentCategoryList(parentId);
    	return list;
    }
    @RequestMapping("/create")
    @ResponseBody
    public XizimallResult insertContentCategory(Long parentId,String name){
    	XizimallResult result=categoryService.insertContentCategory(parentId, name);
    	return result;
    }
    @RequestMapping("/delete")
    @ResponseBody
    public XizimallResult deleteContentCategory(Long id){
    	XizimallResult result=categoryService.deleteContentCategory(id);
    	return result;
    }
    @RequestMapping("/update")
    @ResponseBody
    public XizimallResult updateContentCategory(Long id,String name){
    	XizimallResult result=categoryService.updateContentCategory(id, name);
    	return result;
    }
}
